$(function(){
	var myurl  = location.href;
	console.log(myurl);
	$.ajax({
	  type: 'post',
	  url: "https://klingyang.com/api/share/getBtConfig",
	  data:{"url":myurl},
	  dataType: "json",
	  success: function (data){
		    wx.config({
		      debug: false,
		      appId: data.appId,
		      timestamp: data.timestamp,
		      nonceStr: data.nonceStr,
		      signature: data.signature,
		      jsApiList: ['onMenuShareTimeline','onMenuShareAppMessage','hideAllNonBaseMenuItem']
		    })
		      initShar();
	   },
	   error: function (data){
		 console.log("加载系统变量失败，请重新登录","登录错误");
	   }
	});
	
	function initShar() {
	  wx.onMenuShareTimeline({
	    title: '中烟双喜-春天新品上市，敬请鉴赏',
	    desc: '我的世界，春暖花开',
	    link: myurl,
	    imgUrl: 'https://h5.klingyang.com/sx5/img/shareImg.jpg',
	    success: function () {
	    	shar2();
	    }
	  });
	  wx.onMenuShareAppMessage({
		title: '中烟双喜-春天新品上市，敬请鉴赏',
		desc: '我的世界，春暖花开',
		link: myurl,
	    imgUrl:'https://h5.klingyang.com/sx5/img/shareImg.jpg',
	    success: function () {
	    	 	shar();
	    }
	  });
	  wx.hideAllNonBaseMenuItem();
	}
	wx.ready(initShar); 
	function shar (){
	  // 分享成功后执行
	 // alert('分享成功了，不要乱点没啥的。');
	 	
	}
	function shar2(){
	}
})